stack: Use measure() to measure child widget
authorTimm Bäder <mail@baedert.org>
Thu, 27 Oct 2016 07:38:45 +0000 (09:38 +0200)
committerTimm Bäder <mail@baedert.org>
Fri, 28 Oct 2016 14:33:02 +0000 (16:33 +0200)
Simpler code this way \o/

gtk/gtkstack.c

index fb30df8ea7d9652e49c1d9b87643044656371b75..903657926bd9e6378c80807325a448a63afae3f0 100644 (file)
@@ -2330,20 +2330,7 @@ gtk_stack_measure (GtkCssGadget   *gadget,
 
       if (gtk_widget_get_visible (child))
         {
-          if (orientation == GTK_ORIENTATION_VERTICAL)
-            {
-              if (for_size < 0)
-                gtk_widget_get_preferred_height (child, &child_min, &child_nat);
-              else
-                gtk_widget_get_preferred_height_for_width (child, for_size, &child_min, &child_nat);
-            }
-          else
-            {
-              if (for_size < 0)
-                gtk_widget_get_preferred_width (child, &child_min, &child_nat);
-              else
-                gtk_widget_get_preferred_width_for_height (child, for_size, &child_min, &child_nat);
-            }
+          gtk_widget_measure (child, orientation, for_size, &child_min, &child_nat, NULL, NULL);
 
           *minimum = MAX (*minimum, child_min);
           *natural = MAX (*natural, child_nat);